<%@ page import="com.lms.utils.SqlSessionUtil" %>
<%@ page import="com.lms.utils.GetCategoryUtil" %>
<%@ page import="com.lms.pojo.Category" %>
<%@ page import="java.util.List" %><%--
  Created by IntelliJ IDEA.
  User: hsy
  Date: 2023/5/24
  Time: 19:02
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%--共同侧边栏--%>
<%@ include file="sidebar.jsp" %>
<html>
<head>
</head>
<link rel="stylesheet" type="text/css" href="css/bookAdd.css">
<%
  //调用工具类的方法，查所有的category返回到list集合中
  List<Category> categoryList = GetCategoryUtil.getCategoryList();
%>
<body>
<h2>
  <span>添</span>加<span>图书信息</span>
</h2>


<form action="bookadd" method="get">
  <label>图书名称:</label>
  <input type="text" name="title" required="true">
  <label>作者:</label>
  <input type="text" name="author" required="true">
  <label>出版社:</label>
  <input type="text" name="publisher" required="true">
  <label>图书类型:</label>
  <select name="categoryID" required="true">
    <%--    动态展示图书类型--%>
    <%
      for (Category c : categoryList) {
    %>
    <%--      <option value="1">小说</option>--%>
    <option value="<%=c.getCategoryId()%>"><%=c.getCategoryName()%>
    </option>
    <%
      }
    %>
  </select>
  <label>库存:</label>
  <input type="number" name="stockQuantity" min="1" max="200" step="1" required="true">
  <input type="submit" value="添加"/>
</form>



</body>
</html>
